using System.Data.Entity;
using eCommerce.Core.Domain.Products;
using eCommerce.Data.Mapping.Addresses;
using eCommerce.Data.Mapping.Blogs;
using eCommerce.Data.Mapping.Brands;
using eCommerce.Data.Mapping.Categorys;
using eCommerce.Data.Mapping.Customers;
using eCommerce.Data.Mapping.Messages;
using eCommerce.Data.Mapping.Orders;
using eCommerce.Data.Mapping.Pictures;
using eCommerce.Data.Mapping.Products;
using eCommerce.Data.Mapping.Securitys;
using eCommerce.Data.Mapping.Shippings;
using eCommerce.Data.Mapping.ShoppingCarts;
using eCommerce.Data.Mapping.Shops;
using eCommerce.Data.Mapping.Tradings;

namespace eCommerce.Data
{
    public class YiObjectContext : DbContext
    {
        static YiObjectContext()
        {
            Database.SetInitializer<YiObjectContext>(null);

            
        }

        public YiObjectContext()
            : base("name=YiContext")
        {
           // this.Configuration.ProxyCreationEnabled = false;
        }

        public YiObjectContext(string connStr)
            : base(connStr)
        {
        }


        protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {

            modelBuilder.Configurations.Add(new AddressMapping());
            modelBuilder.Configurations.Add(new BlogMapping());
            modelBuilder.Configurations.Add(new BrandMapping());
        //    modelBuilder.Configurations.Add(new ProductBrandMapping());

            modelBuilder.Configurations.Add(new CategoryMapping());
            //modelBuilder.Configurations.Add(new ProductCategoryMapping());
            modelBuilder.Configurations.Add(new CustomerLogoMapping());
            modelBuilder.Configurations.Add(new CustomerMapping());
            modelBuilder.Configurations.Add(new CustomerRoleMapping());
            modelBuilder.Configurations.Add(new MessageMapping());
            modelBuilder.Configurations.Add(new OrderItemMapping());
            modelBuilder.Configurations.Add(new OrderMapping());
            modelBuilder.Configurations.Add(new PictureMapping());
            modelBuilder.Configurations.Add(new ItemMapping());
     
            modelBuilder.Configurations.Add(new ProductMapping());
            modelBuilder.Configurations.Add(new PermissionRecordMapping());
            modelBuilder.Configurations.Add(new ShipmentMapping());
            modelBuilder.Configurations.Add(new ShoppingCartItemMapping());
            modelBuilder.Configurations.Add(new ShopMapping());
            modelBuilder.Configurations.Add(new TradingIdMapping());
            modelBuilder.Configurations.Add(new TradingMapping());
            modelBuilder.Configurations.Add(new TradingOrderMapping());
          


            modelBuilder.Configurations.Add(new ProductAttributeKeyMapping());
            modelBuilder.Configurations.Add(new ProductAttributeValueMapping());


            modelBuilder.Configurations.Add(new ItemAttributeKeyMapping());
            modelBuilder.Configurations.Add(new ItemAttributeValueMapping());
            modelBuilder.Configurations.Add(new ItemGroupPictureMapping());
            modelBuilder.Configurations.Add(new ItemGroupMapping());
            
        }
    }
}
